﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Shsc.Net.Common;
using Shsc.Net.Common.Validator.Validators;

namespace Shsc.Net.Common.Validator.Attributes
{
    /// <summary>
    /// 必须Check
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class RequestAttribute : BaseValidationAttribute
    {

        private const string ERROR_MESSAGE_ID = "HE_90001";

        /// <summary>
        /// 
        /// </summary>
        public RequestAttribute()
        {
            this.ErrorMessageId = ERROR_MESSAGE_ID;
        }

        /// <summary>
        /// 
        /// </summary>
        public RequestAttribute(string[] _tagerAction)
        {
            this.ErrorMessageId = ERROR_MESSAGE_ID;
            this.TagerAction = _tagerAction;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="_errorMessageId"></param>
        /// <param name="_errorMessageResourceName"></param>
        /// <param name="_tagerAction"></param>
        public RequestAttribute(string[] _tagerAction,
            string _errorMessageId,
            string _errorMessageResourceName)
        {
            this.ErrorMessageId = _errorMessageId;
            this.ErrorMessageResourceName = _errorMessageResourceName;
            this.TagerAction = _tagerAction;
        }

        /// <summary>
        /// 创建验证器
        /// </summary>
        /// <returns></returns>
        protected override BaseValidator CreateValidator()
        {
            return new RequestValidator();
        }
    }
}
